/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tubosmonterrey.cotizador.tb;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author rsoberanis
 */
@Entity
@Table(name = "tbiva")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tbiva.findAll", query = "SELECT t FROM Tbiva t"),
    @NamedQuery(name = "Tbiva.findById", query = "SELECT t FROM Tbiva t WHERE t.id = :id"),
    @NamedQuery(name = "Tbiva.findByIva", query = "SELECT t FROM Tbiva t WHERE t.iva = :iva")})
public class Tbiva implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "iva")
    private Double iva;
    @OneToMany(mappedBy = "iva")
    private Collection<Tbcotizacion> tbcotizacionCollection;

    public Tbiva() {
    }

    public Tbiva(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Double getIva() {
        return iva;
    }

    public void setIva(Double iva) {
        this.iva = iva;
    }

    @XmlTransient
    public Collection<Tbcotizacion> getTbcotizacionCollection() {
        return tbcotizacionCollection;
    }

    public void setTbcotizacionCollection(Collection<Tbcotizacion> tbcotizacionCollection) {
        this.tbcotizacionCollection = tbcotizacionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tbiva)) {
            return false;
        }
        Tbiva other = (Tbiva) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.tubosmonterrey.cotizador.tb.Tbiva[ id=" + id + " ]";
    }
    
}
